IoT M4-R5 Notes according to NIELIT O Level Syllabus
1. Introduction to IoT Components
An IoT system is a complex integration of various physical and digital components that work together to sense, communicate, analyze, and act upon data.
A. Sensing Components (The "Senses" of IoT)
These are hardware devices that detect and measure physical properties from the environment and convert them into electrical signals (data).
Sensors:
Temperature Sensor (e.g., LM35, DHT11): Measures ambient temperature.
Humidity Sensor (e.g., DHT11, DHT22): Measures the amount of moisture in the air.
Radio Frequency (RF) modules (e.g., 433MHz): Simple, low-cost modules for one-way wireless communication.
Cellular (4G/LTE, 5G, NB-IoT): Uses cellular networks for long-range communication.
C. Computing & Control Components (The "Brain" of IoT)
This is the core processing unit that reads sensor data, processes it, makes decisions, and sends commands to actuators.
Microcontrollers (MCUs): Small, low-cost computers on a single integrated circuit.
Microprocessors (MPUs): More powerful than MCUs, typically requiring external components.
D. Structural Components
The physical hardware that forms the platform for the electronic components.
Boards: The main PCB that hosts the microcontroller.
Shields: Add-on boards that plug directly into the main board.
Modules: Stand-alone components that can be connected via wires.
Breadboard: A reusable platform for prototyping circuits.
Jumper Wires: Used to make temporary connections on a breadboard.
2. Introduction to Arduino
Arduino is an open-source electronics platform based on easy-to-use hardware and software.
A. Why Arduino?
Inexpensive
Cross-platform
Simple, clear programming environment
Open-source and extensible software & hardware
Large community support
B. Arduino Uno Board Anatomy (Key Components)
Microcontroller: ATmega328P
Digital I/O Pins: 14 (Pins 0-13)
Analog Input Pins: 6 (Pins A0-A5)
Power Pins: 3.3V, 5V, GND, Vin
USB Port: For connecting to a computer
DC Barrel Jack: For external power supply
Reset Button: Resets the microcontroller
On-board LED (Pin 13): Connected to digital pin 13
C. Arduino IDE (Integrated Development Environment)
The software used to write, compile, and upload code (called a sketch) to the Arduino board.
Basic Structure of a Sketch:
// 1. Variable Declarations & Pre-processor Directives
int sensorPin = A0; // Assign analog pin A0 to variable 'sensorPin'
// 2. setup() function - Runs only once when the sketch starts
void setup() {
pinMode(13, OUTPUT); // Initialize digital pin 13 as an output
Serial.begin(9600); // Initialize serial communication at 9600 baud rate
}
// 3. loop() function - Runs repeatedly forever after setup()
void loop() {
digitalWrite(13, HIGH); // Turn the LED on (HIGH is the voltage level)
delay(1000); // Wait for a second (1000 milliseconds)
digitalWrite(13, LOW); // Turn the LED off by making the voltage LOW
delay(1000); // Wait for a second
}
D. Basic Arduino Commands/Functions
Function
Description
pinMode(pin, mode)
Configures a pin as INPUT or OUTPUT
digitalWrite(pin, value)
Writes HIGH (5V) or LOW (0V) to a digital pin
digitalRead(pin)
Reads value from a digital pin (HIGH or LOW)
analogRead(pin)
Reads value from analog pin (0 to 1023)
analogWrite(pin, value)
Writes PWM value (0 to 255) to a pin
Serial.begin(speed)
Initializes serial communication
Serial.print(data)
Prints data to the Serial Monitor
delay(ms)
Pauses program for specified milliseconds
3. Interfacing Components with Arduino
A. Interfacing a Digital Sensor (e.g., PIR Sensor)
Connection:
VCC → 5V
GND → GND
OUT → Digital Pin (e.g., 2)
Code Logic:
pinMode(2, INPUT); in setup()
int motion = digitalRead(2); in loop()
B. Interfacing an Analog Sensor (e.g., LDR)
Connection:
One leg → 5V
Other leg → Analog Pin (e.g., A0) and to one leg of a resistor (e.g., 10kΩ)
Other leg of the resistor → GND
Code Logic:
int lightValue = analogRead(A0); in loop()
C. Interfacing an Actuator (e.g., LED)
Connection:
Anode (Long leg) → Digital Pin (e.g., 13) through a resistor (e.g., 220Ω)
Cathode (Short leg) → GND
Code Logic:
pinMode(13, OUTPUT); in setup()
digitalWrite(13, HIGH); or digitalWrite(13, LOW); in loop()
D. Interfacing an Actuator (e.g., Relay Module)
Connection:
VCC → 5V
GND → GND
IN → Digital Pin (e.g., 7)
Code Logic: Treat it like an LED
digitalWrite(7, HIGH) activates the relay
digitalWrite(7, LOW) deactivates it
CAUTION: The relay's high-voltage terminals are used to control AC appliances. Extreme care must be taken to avoid electric shock.
4. Key Concepts for Practicals
Voltage Divider Circuit: Crucial for understanding how many analog sensors work.
Pull-up/Pull-down Resistors: Used with digital inputs to ensure the pin is in a known state.
PWM (Pulse Width Modulation): A technique to get analog-like results with a digital signal.
Serial Monitor: An essential tool for debugging.
Summary: This chapter forms the foundation of practical IoT development. Understanding the role of each component and mastering their interfacing with an Arduino using the basic functions is the primary goal.